const routes = [
  {
    path: '/redirect',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('pages/redirect/index.vue'),
      }
    ]
  },
  {
    path: '/login',
    component: () => import('pages/LoginPage.vue'),
    meta: {
      requiresGuest: true,
      title: '登录'
    }
  },
  {
    path: '/register',
    component: () => import('pages/RegisterPage.vue'),
  },
  {
    path: '/lock',
    component: () => import('pages/LockScreen.vue'),
  },
  {
    path: '/401',
    component: () => import('pages/error/Error401.vue'),
  },
  {
    path: '/:catchAll(.*)*',
    component: () => import('pages/error/Error404.vue'),
  },
  {
    path: '',
    component: () => import('layouts/MainLayout.vue'),
    redirect: "/index",
    children: [
      {
        path: '/index',
        component: () => import('pages/IndexPage.vue'),
        meta: {
          requiresAuth: true, // 需要登录
          title: '首页'
        }
      }
    ]
  },

  {
    path: '/dashboard',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      { path: '', component: () => import('pages/dashboard') }
    ]
  },
  {
    path: '/system/user',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/user'),
        meta: { title: '用户管理' }
      }
    ]
  },
  {
    path: '/system/role',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/role'),
        meta: { title: '角色管理' }
      }
    ]
  },
  {
    path: '/system/menu',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/menu'),
        meta: { title: '菜单管理' }
      }
    ]
  },
  {
    path: '/system/dept',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/dept'),
        meta: { title: '部门管理' }
      }
    ]
  },
  {
    path: '/system/post',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/post'),
        meta: { title: '岗位管理' }
      }
    ]
  },
  {
    path: '/system/dict',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/dict'),
        meta: { title: '字典管理' }
      }
    ]
  },
  {
    path: '/system/config',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/config'),
        meta: { title: '参数设置' }
      }
    ]
  },
  {
    path: '/system/attachment',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/attachment'),
        meta: { title: '附件管理' }
      }
    ]
  },
  {
    path: '/system/notice',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/notice'),
        meta: { title: '公告管理' }
      }
    ]
  },
  {
    path: '/system/monitor/operlog',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/monitor/operlog'),
        meta: { title: '操作日志' }
      }
    ]
  },
  {
    path: '/system/monitor/loginlog',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/monitor/loginlog'),
        meta: { title: '登录日志' }
      }
    ]
  },
  {
    path: '/system/whitelist',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        path: '',
        component: () => import('pages/system/whitelist'),
        meta: { title: '白名单管理', requiresAuth: true }
      }
    ]
  }
]

export default routes
